package mainControlsTest;

import junit.framework.TestCase;
import mainControls.StaffScheduleChecker;
import smallTools.SimpleTime;
import entities.Section;
import entities.Staff;

public class StaffScheduleCheckerTest extends TestCase {

	public void test_StaffScheduleChecker() {
		StaffScheduleChecker sc = new StaffScheduleChecker();
		Staff staff1 = new Staff("8001");
		Section sc1 = new Section("sectionId1", 60, 2, "8001");
		SimpleTime sectionId1_startTime = new SimpleTime("Mon", 11, 30);
		sc1.setSectionStartTime(sectionId1_startTime);
		staff1.addNewSection("sectionId1");
		SimpleTime startTime1 = new SimpleTime("Mon", 12, 30);
		SimpleTime startTime2 = new SimpleTime("Mon", 10, 30);
		SimpleTime startTime3 = new SimpleTime("Mon", 13, 30);

		Section sc_test1 = new Section("sectionId_test1", 60, 2, "8001");
		staff1.addNewSection("sectionId_test1");
		assertEquals(false, sc.check(sc_test1, startTime1));
		assertEquals(false, sc.check(sc_test1, startTime2));
		assertEquals(true, sc.check(sc_test1, startTime3));

		Section sc_test2 = new Section("sectionId_test2", 60, 1, "8001");
		staff1.addNewSection("sectionId_test2");
		assertEquals(true, sc.check(sc_test2, startTime2));
	}

	public void tearDown() {
		Section.clear();
		Staff.clear();
	}
}
